import java.util.ArrayList;
import java.util.List;

public class Num1759 {
    public int countHomogenous(String s) {
        long count = 0;
        int n = s.length();
        char c = s.charAt(0);
        int len = 0;
        for (int i = 0; i < n; i++) {
            char ch = s.charAt(i);
            if ( c == ch) {
                len++;
            }else {
                count += (long)len * (len + 1) / 2;
                len = 1;
                c = ch;
            }
        }
        count += (long)len * (len + 1) / 2;
        int nums = (int)(count % 1000000007);
        return nums;
    }
}
